GtkStackSwitcher: Disconnect signals when a child is removed
authorMatthias Clasen <mclasen@redhat.com>
Tue, 9 Sep 2014 18:48:59 +0000 (14:48 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 9 Sep 2014 18:48:59 +0000 (14:48 -0400)
This is quite an oversight, and causes bad things to happen if
the child is later changed.

https://bugzilla.gnome.org/show_bug.cgi?id=736307

gtk/gtkstackswitcher.c

index 35d82b8be28e75b4e8396ba893a4d4f4192aa61e..44fc7c8191b153175c4c4bd16ae3f434adeb2519 100644 (file)
@@ -330,6 +330,11 @@ on_stack_child_removed (GtkContainer     *container,
   GtkStackSwitcherPrivate *priv;
 
   priv = gtk_stack_switcher_get_instance_private (self);
+
+  g_signal_handlers_disconnect_by_func (widget, on_title_icon_visible_updated, self);
+  g_signal_handlers_disconnect_by_func (widget, on_position_updated, self);
+  g_signal_handlers_disconnect_by_func (widget, on_needs_attention_updated, self);
+
   button = g_hash_table_lookup (priv->buttons, widget);
   gtk_container_remove (GTK_CONTAINER (self), button);
   g_hash_table_remove (priv->buttons, widget);